import { createStore } from 'vuex'
import vuexP from 'vuex-persistedstate'
export default createStore({
  state: {
    list:[],//保存请求过来的数据
  },
  getters: {
  },
  mutations: {
    setList(state,data){
        state.list = data


    },
    sendMsg(state,obj){
        let {index,con} = obj
        state.list[index].content.push({
            con:con,
            time:new Date().toLocaleString()
        })

    },
    // 撤回
    del(state,obj){
        let {index,i} = obj
        state.list[index].content.splice(i,1)

    },
    // 全部撤回
    delAll(state,index){
        state.list[index].content = []
    }
  },
  actions: {
  },
  modules: {
  },
  plugins:[vuexP()]
})
